package com.wcn.sell.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/weixin")
@Slf4j
public class WeixinController {
    @GetMapping("/auth")
    public void auth(@RequestParam("code") String code) {
        log.info("进入auth方法。。。");
        log.error("code={}", code);
        String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd898fcb01713c568&redirect_uri=http://sell.natapp4.cc/sell/weixin/auth&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
        RestTemplate restTemplate = new RestTemplate();
        String response = restTemplate.getForObject(url, String.class);
        log.error("response={}", response);
    }
}
